package cn.itsub.sodo.action.interval;

import cn.itsub.sodo.Node;

public class MoveBy extends MoveTo {

    public static MoveBy action(float time, float x, float y) {
        return new MoveBy(time, x, y);
    }

    protected MoveBy(float time, float x, float y) {
        super(time, x, y);
        delta.x = x;
        delta.y = y;
    }

    @Override
    public IntervalAction copy() {
        return new MoveBy(duration, delta.x, delta.y);
    }

    @Override
    public void start(Node aTarget) {
        float savedX = delta.x;
        float savedY = delta.y;
        super.start(aTarget);
        delta.x = savedX;
        delta.y = savedY;
    }

}
